﻿using System;
using System.Diagnostics;
using System.Linq;
using Circa.Tools;

namespace Circa.Protocol.Irc {
    public class UndernetChannel: Channel {
        public DateTime CreatedAt { get; private set; }

        public UndernetChannel( ): base( ) {
            verbs.Add( "329", RplCreationTime );
            verbs.Add( "333", RplTopicWhoTime );
        }

        public void RplCreationTime( IrcMessage m ) {
            CreatedAt = UnixTimestampConverter.FromString( m.Args[ 0 ] );
        }

        public void RplTopicWhoTime( IrcMessage m ) {
            Debug.Print( "Channel.RplTopicWhoTime: who={{{0}}} time={{{1}}}", m.Args[ 0 ], m.Args[ 1 ] );

            TopicInfo ti = TopicInfo.First( );
            ti.SetBy = m.Args[ 0 ];
            ti.SetAt = UnixTimestampConverter.FromString( m.Args[ 1 ] );
        }

    }

}
